/*
 * @Author: liyongxuan
 * @Date: 2018-1-10 10:37:42
 * @Last Modified by: liyongxuan
 * @Last Modified time: 2018-1-10 10:37:42
 * @description：项目管理-拟投资-打款信息组件
 */
<template>
    <div class="ca-box ca-m-t-20 ca-p-20 ca-m-b-20">
      <div v-if="indexOrEdit" class="ca-title">
        <el-button type="text" class="ca-edit-btn el-icon-edit ca-m-r-10 right-fs-30" v-if="isNoAuth('拟投资项目-打款-编辑')" @click="indexOrEdit = false">编辑</el-button>
        <h3 class="ca-m-b-20">打款信息</h3>
        <el-form ref="dataForm">
            <table class="ca-table ca-m-t-20">
                <tr class="height-line">
                    <th width="15%">打款时间</th>
                    <th width="19%">打款人</th>
                    <th width="19%">打款金额</br>（万元）</th>
                    <th width="27%">收款账号</th>
                    <th width="15%">收款人</th>
                </tr>
                <tr v-for="(item,index) in resultDataList" :key="index">
                    <td>{{$moment(item.remittanceDate).format('YYYY-MM-DD')}}</td>
                    <td>{{item.remittanceUser}}</td>
                    <td>{{item.remittanceAmount|format1}}</td>
                    <td>{{item.receiveAccount}}</td>
                    <td>{{item.receiveUser}}</td>
                </tr>
            </table>
        </el-form>
      </div>
      <csRemitInfo v-else @close="closeEdit" :itemId="itemId" :resultDataList="resultDataList"></csRemitInfo>
    </div>
</template>

<script type="text/ecmascript-6">
    import { api } from '../../../api';
    import { apiHttp, STATUS_HTTP_SUCCESS } from '__service/csHttp';
    import { isNoAuth } from '__service/utils';
    export default {
        data() {
            return {
              indexOrEdit: true,
              resultDataList: []//打款信息列表
            }
        },
        watch: {

        },
        props: ['itemId'],
        mounted() {
            isNoAuth()
            this.getQuasiRemitianceEntity()
        },
        methods: {
            // 查询打款信息
            async getQuasiRemitianceEntity() {
                const {resCode,data} = await apiHttp(api.GET_QUASI_REMITTANCE_ENTITY, {itemId: this.itemId})
                if (resCode === STATUS_HTTP_SUCCESS) {
                    this.resultDataList = data
                }
            },
            // 关闭编辑页
            closeEdit() {
                this.indexOrEdit = true
                this.getQuasiRemitianceEntity()
            }
        },
        components: {
          csRemitInfo: require('./edit')// 打款信息编辑组件
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.right-fs-30{
   float:right;
}
.height-line{
    line-height: 30px
}
</style>
